package com.shuzixiangcun.service.front;

import com.shuzixiangcun.dao.XiangcungaikuangDao;
import com.shuzixiangcun.entity.Xiangcungaikuang;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;

/**
 * 乡村概况表(Xiangcungaikuang)表服务实现类
 *
 * @author makejava
 * @since 2024-06-24 08:26:20
 */
@Service
public class XiangcungaikuangFServiceImpl {
    @Resource
    private XiangcungaikuangDao xiangcungaikuangDao;

    /**
     * 通过ID查询单条数据
     *
     * @param profileId 主键
     * @return 实例对象
     */

    public Xiangcungaikuang queryById(Object profileId) {
        return this.xiangcungaikuangDao.queryById(profileId);
    }


    /**
     * 新增数据
     *
     * @param xiangcungaikuang 实例对象
     * @return 实例对象
     */

    public Xiangcungaikuang insert(Xiangcungaikuang xiangcungaikuang) {
        this.xiangcungaikuangDao.insert(xiangcungaikuang);
        return xiangcungaikuang;
    }

    /**
     * 修改数据
     *
     * @param xiangcungaikuang 实例对象
     * @return 实例对象
     */

    public Xiangcungaikuang update(Xiangcungaikuang xiangcungaikuang) {
        this.xiangcungaikuangDao.update(xiangcungaikuang);
        return this.queryById(xiangcungaikuang.getProfileId());
    }

    /**
     * 通过主键删除数据
     *
     * @param profileId 主键
     * @return 是否成功
     */

    public boolean deleteById(Object profileId) {
        return this.xiangcungaikuangDao.deleteById(profileId) > 0;
    }
}
